<template>
	<view>
		<u-navbar title="卡充值记录" :custom-back="back"></u-navbar>
		<view class="" v-if="page=='page'">
			<view class="" v-for="item in searchdata"
				style="display: flex; justify-content: space-between;padding: 22rpx 30rpx;align-items: center;"
				@click="zdxqfn(item)">
				<view class="">
					<view class="" style="font-size: 34rpx;line-height: 60rpx;">
						{{item.printid}}
					</view>
					<view class="" style="font-size: 28rpx;color: #8f8f94;">
						{{item.sjzfc}}
					</view>
				</view>
				<view style="color: #2093f5;font-weight: 600;font-size: 26px; ">
					{{item.je/100}}{{$z.$t("元")}}
				</view>
			</view>

		</view>
		<view class="page" v-else>
			<view class=""
				style="display:flex;justify-content: space-between;height: 100rpx;align-items: center;padding: 0 30rpx;font-size: 30rpx;">
				<view class="">

					{{$z.$t("金额")}}
				</view>
				<view class="" style="font-size: 38rpx;">
					{{tapitem.je/100}}{{$z.$t("元")}}
				</view>
			</view>
			<u-line />
			<view class=""
				style="display:flex;justify-content: space-between;height: 100rpx;align-items: center;padding: 0 30rpx;font-size: 30rpx;"
				v-for="(item,index) in czlist">
				<view class="">
					{{$z.$t(item.label)}}
				</view>
				<view class="">
					{{$z.$t(zhifn(item))}}
				</view>
			</view>

		</view>

		<u-picker v-model="show" mode="time" :params="params" :default-time="defaultTime" @confirm="confirm"></u-picker>
	</view>
</template>

<script>
	// import settingvue from "@/mixins/setting.vue"
	export default {
		data() {
			return {
				// 组件内部parmas参数默认值：
				params: {
					year: true,
					month: true,
					day: true,
					hour: true,
					minute: true,
					second: true,
					province: true,
					city: true,
					area: true,
					timestamp: true, // 1.3.7版本提供
				},
				mode: "",
				show: false,
				fromdata: {},
				defaultTime: "",
				tapkey: "",
				searchdata: [],
				zftype: {
					0: this.$z.$t("微信支付"),
					1: this.$z.$t("支付宝支付"),
					2: this.$z.$t("余额支付"),
					8: this.$z.$t("宝付"),
					16: this.$z.$t("融创支付"),
				},
				page: "page",
				tapitem: {},
				query: {},
				czlist: [{
					value: "printid",
					label: this.$z.$t("卡号")
				}, {
					value: "ddh",
					label: this.$z.$t("订单号")
				}, {
					value: "uUser",
					label: this.$z.$t("用户")
				}, {
					value: "zftype",
					label: this.$z.$t("类型")
				}, {
					value: "jyh",
					label: this.$z.$t("交易号")
				}, {
					value: "jesj",
					label: this.$z.$t("实际金额")
				}, {
					value: "sjzfc",
					label: this.$z.$t("支付时间")
				}],

			}
		},
		// mixins: [settingvue],
		onLoad(query) {

			this.query = query;
			this.getdata();
		},
		methods: {
			zhifn(item) {
				if (item.value == 'zftype') {
					return this.zftype[this.tapitem.type]
				} else if (item.value == 'jesj') {
					return Number(this.tapitem.jesj) / 100
				}
				return this.tapitem[item.value]
			},
			back() {
				if (this.page != 'page') {
					this.page = "page"
				} else {
					uni.navigateBack();
				}
			},
			zdxqfn(item) {
				this.tapitem = item;
				this.page = 'pagexq'
			},
			timetap(item) {
				let str = this.fromdata[item];
				this.tapkey = item;
				this.defaultTime = str;
				this.show = true;
			},
			confirm(data) {
				let str = `${data.year}-${data.month}-${data.day} ${data.hour}:${data.minute}:${data.second}`;
				this.fromdata[this.tapkey] = str;
			},
			async getdata() {
				let USearch = await this.$store.dispatch("user/getUSearch");
				let fromdata = {};
				fromdata.printid = this.query.printid;
				this.fromdata = fromdata;
				this.searchfn();
			},
			async searchfn() {
				let GetRfCZCard = await uni.$z.request("/GetRfCZCard", this.fromdata);

				this.searchdata = GetRfCZCard;
			}
		}
	}
</script>

<style>

</style>